layui.use(['upload','element','table','form','laytpl'],function(){
			 var $ = layui.jquery
  		,upload = layui.upload
			,table = layui.table
			,layer = layui.layer
			,element =layui.element
			,form = layui.form
			,laytpl = layui.laytpl
			var teacherInfo = document.getElementById("teacherInfo").innerHTML;
			var userKey = JSON.parse(sessionStorage.getItem("userKey"));
			console.log(userKey)
			if(userKey) {
				//如果存在,则说明登录过,先比对过期时间
				var delayTime = userKey.delayTime
				var nowTime = new Date().getTime()
				if(nowTime < delayTime) {
					//登录未失效
					laytpl(teacherInfo).render(userKey, function(html) {
						$("#teacherInfoView").html(html)
						element.render()
					})
				}
			} 
			var studentPaperList = table.render({
					elem:'#studentPaperList',
					url:"http://localhost:8888/studentPaper/allStudentPaper",
					cols:[[
						  {field:'id', width:80, title: 'ID', sort: true}
				      ,{field:'studentNo', width:120, title: '学号'}
				      ,{field:'name', width:80, title: '姓名'}
				      ,{field:'title', width:200, title: '试卷', sort: true}
				      ,{field:'score',width:80,  title: '分数', sort: true}
				      ,{field:'comment',edit:true,title:'评论',sort:true}
				      
					]]
			});
			table.on('edit(studentPaperList)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
			  
			  $.ajax({
			  	url:"http://localhost:8888/studentPaper/addComment",
			  	type:'post',
			  	data:{'id':obj.data.id,'comment':obj.value},
			  	success:function(){
			  		layer.msg("提交评论成功")
			  	}
	
			  })			 
			});
			
			
  });
